package dev.ece.core.cells.shadow;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import dev.ece.core.cells.Cell;
import dev.ece.util.GLUtils;
import dev.ece.util.tools.Camera;
/**
 * 阴影
 * @author DEVILIVED
 *
 */
public interface Shadow extends Cell, ShadowEvent {

	public static final Logger LOG = LogManager.getLogger(Shadow.class);
	
	/**
	 * 绘制深度图
	 * @param engine
	 * @param camera
	 */
	default void renderDepthMap(Camera camera) {
		GLUtils.glPushMatrix();
		try {
			this.calculate();
			this.onRenderDepthMap(camera);
		} catch(Exception e) {
			LOG.error("渲染深度图错误", e);
		}
		GLUtils.glPopMatrix();
	}
	
}
